<template>   
<!-- 有邮箱及登录密码 -->
    <div>
        <div class="text">
            帐号设置
        </div> 
        <div class="row">
            <van-cell title="手机号" is-link to='/bindphone' :value="phoneNum"/>
<!-- 判断是否有绑定邮箱 -->
            <van-cell v-if="email" title="邮箱" is-link to="/changemailbox1"  :value="email"/>
            <van-cell v-else title="邮箱" is-link to="/bindmailbox" value="未绑定"/>

        </div>
        <div class="text">
            安全设置
        </div> 
        <div class="row">
            <van-cell v-if="LoginPassword" title="修改登录密码" is-link to="/changeloginpassword" />
            <van-cell v-else title="设置登录密码" is-link to='/setloginpassword'/>
            <!-- <van-cell title="修改登录密码" is-link to="/changeloginpassword" /> -->
            

            <van-cell v-if="TransactionPassword" title="修改交易密码" is-link to="/ChangeTransactionPassword" />
            <van-cell v-if="TransactionPassword" title="忘记交易密码" is-link to="/ForgotTradingPassword" />
            <van-cell v-else title="设置交易密码" is-link  to='/settransactionpassword' />

        </div>
    </div>
</template>

<script>
//调用查询是否有登录密码的后端接口
import { IfLoginPassword } from "../../../https/loginApi";

    export default {
    data(){
        return{
            phoneNum:'', //从后端获取号码
            email:'' ,    //从后端获取邮箱
        TransactionPassword:'', //从后端获取交易密码
        LoginPassword:''
        }
    },
    created() {
       this.phoneNum=this.$store.state.userNumber
       this.email=this.$store.state.email
       this.TransactionPassword=this.$store.state.TransactionPassword
    
    //一进页面发请求询问是否有登录密码
    IfLoginPassword(this.phoneNum)
        .then(res=>{
            this.LoginPassword=true
            console.log('询问是否有登录密码结果：',res);
        })
        .catch(err=>{
            this.LoginPassword=false
            console.log(err);

        })


    },
    methods:{
          
    }
}

</script>


<style scoped>
        .text{
        width: 92%;
        margin: auto;
        font-size: 14px;
        color:#999999;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .row{
        margin-top: 10px;
        margin-bottom: 10px;
    }

</style>